Skip to content

Conversation

Bobi222
Copy link

@Bobi222 Bobi222 commented Oct 10, 2025

Added a regex to remove the quotation marks in the begging and in the end of the title (single or double).

Fixes and closes #1134

@Bobi222 Bobi222 requested a review from a team as a code owner October 10, 2025 19:03
@CLAassistant
Copy link

CLAassistant commented Oct 10, 2025

CLA assistant check
All committers have signed the CLA.

Comment on lines +142 to +160

String generateTitle(String originalMessage) {
String chatGptTitleRequest =
"Summarize the following question into a concise title or heading not more than 5 words, remove quotations if any: %s"
.formatted(originalMessage);
Optional<String> chatGptTitle = chatGptService.ask(chatGptTitleRequest, null);
String title = chatGptTitle.orElse(createTitle(originalMessage));

// 🔧 FIX: Remove surrounding quotes
title = title.replaceAll("^\"|\"$", "");

if (title.length() > TITLE_MAX_LENGTH) {
title = title.substring(0, TITLE_MAX_LENGTH);
}

return title;
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a leftover or something? that new method isnt used anywhere. remove it or use it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, yes my bad i will find a cleaner fix. Pardon my mistakes im new to contributing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries, here to help :)

.formatted(originalMessage);
Optional<String> chatGptTitle = chatGptService.ask(chatGptTitleRequest, null);
String title = chatGptTitle.orElse(createTitle(originalMessage));
title = title.replaceAll("^[\"']|[\"']$", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please chain it instead.

Suggested change
title = title.replaceAll("^[\"']|[\"']$", "");
String title = chatGptTitle.orElse(createTitle(originalMessage))
.replaceAll("^[\"']|[\"']$", "");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not a fan of your regex for two reasons:

  • currently it also triggers when just one condition is met, for example Need help with "foo" or "Foo" is weird, it shouldnt trigger here. Only for "Foo bar".
  • if we do the first part then regex is overkill for this

so i propose to instead add if (title.startsWith("\"") && title.endsWith("\"")) { title = title.substring(1, title.length() - 1); } or something like that.

that said, i dont have a strong opinion on avoiding regex here specifically, so whatever. but please fix the first part.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok im on it. Thanks for the guidance.

Comment on lines -178 to +199
event.getGuild())
.and(sendMessageToTransferrer.apply(createdForumPost)))
event.getGuild()).and(sendMessageToTransferrer.apply(createdForumPost)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you didnt change anything here. i wouldnt be surprised if this will be auto-reverted the second you run spotless

@Zabuzard Zabuzard added bug Something isn't working priority: normal labels Oct 13, 2025
@Zabuzard Zabuzard changed the title Titles by gpt fix Fixes quotation marks in titles on /transfer Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inconsistency in titles generated by GPT

3 participants